<?php 
namespace app\api\controller\v1;

use think\Controller;

class Shop extends Controller
{
	public function reader()
	{ 
	    $requests  = input('post.');
	    $size = input('size') ? input('size') : 20;
	    $model = model('Shop');
	    $data = $model->reader($size);// 查询数据
	    if ($data) {
	        $code = 200;
	    } else {
	        $code = 404;
	    }
	    $data = [
	        'code' => $code,
	        'data' => $data
	    ];
	    return json($data);
	}
	public function category()
	{ 
	    $requests  = input('post.');
		$pid = input('pid');
	    $size = input('size') ? input('size') : 20;
	    $model = model('Shop');
	    $data = $model->category($size,$pid);// 查询数据
	    if ($data) {
	        $code = 200;
	    } else {
	        $code = 404;
	    }
	    $data = [
	        'code' => $code,
	        'data' => $data
	    ];
	    return json($data);
	}
    
}